﻿using System.Collections.Generic;
namespace NodeEditor
{
    public class RuntimeValue
    {
        readonly Dictionary<string, object> valueDict = new Dictionary<string, object>();
        public void SetValue(string key, object value)
        {
            valueDict[key] = value;
        }
        public T GetValue<T>(string key,T defaultValue)
        {
            object o;
            if(valueDict.TryGetValue(key, out o))
            {
                return (T)o;
            }
            return defaultValue;
        }

        public object GetValue(string key)
        {
            object o;
            valueDict.TryGetValue(key, out o);
            return o;
        }
    }
}